package com.chf.entities.renderer;

import com.chf.entities.entity.ZombiePlusEntity;
import com.chf.mods.FirstMod;
import net.minecraft.client.model.ZombieModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;

/**
 * 自定义僵尸渲染器
 *
 * @author niooooo
 */
public class ZombiePlusRenderer extends MobRenderer<ZombiePlusEntity, ZombieModel<ZombiePlusEntity>> {

    private static final ResourceLocation TEXTURE = ResourceLocation.parse(
            FirstMod.MOD_ID + ":textures/entity/zombie_plus.png");

    public ZombiePlusRenderer(EntityRendererProvider.Context context) {
        super(context, new ZombieModel<>(context.bakeLayer(ModelLayers.ZOMBIE)), 0.5F);

        // 添加僵尸盔甲层
        this.addLayer(new HumanoidArmorLayer<>(
                this,
                new ZombieModel<>(context.bakeLayer(ModelLayers.ZOMBIE_INNER_ARMOR)),
                new ZombieModel<>(context.bakeLayer(ModelLayers.ZOMBIE_OUTER_ARMOR)),
                context.getModelManager()
        ));
    }

    @Override
    public @NotNull ResourceLocation getTextureLocation(@NotNull ZombiePlusEntity entity) {
        return TEXTURE;
    }
}
